﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ninject.Modules;
using Timetable.Base.Entities;
using Timetable.Base.Interfaces.Validators;
using Timetable.Data.Context;
using Timetable.Data.Context.Interfaces;
using Timetable.Data.Repositories;
using Timetable.Base.Interfaces.Repositories;
using Timetable.Base.Interfaces.DataSources;
using Timetable.Base.Interfaces.Services;
using Timetable.Data.Services;
using System.Data.SqlClient;
using Timetable.Data.Validators;
using Timetable.Data.Services.DataServices;
using Timetable.Base.Interfaces.Services.DataServices;

namespace Timetable.Data
{
    public class DataContainer : NinjectModule  
    {
        #region Overrides of NinjectModule

        public override void Load()
        {
            Kernel.Bind<IDataContext>().To<DataContext>().InSingletonScope();
            Kernel.Bind<IDatabase>().To<DataContext>().InSingletonScope();
            Kernel.Bind(typeof(IRepository<>)).To(typeof(Repository<>));

            // Services registration
            Kernel.Bind<IConfigurationService>().To<ConfigurationService>();
            Kernel.Bind<IDataService<Auditorium>>().To<AuditoriumService>();
            Kernel.Bind<IDataService<Building>>().To<BuildingService>();
            Kernel.Bind<IDataService<Course>>().To<CourseService>();
            Kernel.Bind<IDataService<Faculty>>().To<FacultyService>();
            Kernel.Bind<IDataService<Group>>().To<GroupService>();
            Kernel.Bind<IDataService<Lecturer>>().To<LecturerService>();
            Kernel.Bind<IDataService<Schedule>>().To<ScheduleService>();
            Kernel.Bind<IDataService<Time>>().To<TimeService>();
            Kernel.Bind<IDataService<Tutorial>>().To<TutorialService>();
            Kernel.Bind<IDataService<TutorialType>>().To<TutorialTypeService>();
            Kernel.Bind<IDataService<Department>>().To<DepartmentService>();
            Kernel.Bind<IDataService<ScheduleInfo>>().To<ScheduleInfoservice>();
            Kernel.Bind<IDataService<Speciality>>().To<SpecialityService>();

            // Validators registration
            Kernel.Bind(typeof(IValidator<>)).To(typeof(BaseValidator<>));
            Kernel.Bind<IValidator<ScheduleInfo>>().To<ScheduleAttributeValidator>();
        }

        #endregion
    }
}
